#include <iostream>
#include <cstring>
#include <queue>
#include <map>
#include <vector>
#include <string.h>
using namespace std;

int n, m;
const int mod = 1e6 + 7;
int a[110];
int f[110][110]; //前i盆花使用j盆花方案数

int main()
{
    cin >> n >> m;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
    }

    f[0][0] = 1;

    for (int i = 1; i <= n; i++)
    {
        for (int j = 0; j <= m; j++)
        {
            for (int k = 0; k <= min(j, a[i]); k++)
            {
                f[i][j] = (f[i][j] + f[i - 1][j - k]) % mod;
            }
        }
    }
    cout << f[n][m] << endl;
    //system("pause");
    return 0;
}
